#{extends 'main.html' /}

  <form action="" >
      <input type="text" id="stxt" value="" placeholder="productno">
  </form>
  <button type="button" id="but">查询</button>
  <p id='pp'></p>
  <table>
    <thead>
      <tr>
        <th>商品号</th><th>商品名称</th><th>单价</th><th>数量</th><th>删除</th>
      </tr>
    </thead>
    <tbody>

    </tbody> 
  </table>
<script type="text/javascript">

  $(document).ready(function(){
    $("#but").click(function(){
        $.ajax({
        url: '@{SaleOrders.searchProduct}',
        type: 'GET',
        data: {
          'pno': $('#stxt').val()
        },
        success: function(data) {
          var str1 = data.productno
          var str2 = data.productName
          var str3 = data.price
          ;
          
           $('tbody').append("<tr><td>"+str1+"</td><td>"+str2+"</td><td>"+str3+"</td><td>1</td><td>1</td></tr>");
        
        },
        error: function(data) {
          console.log(data);
        }
      });
    });
  });

</script>
